package com.cc.controller;

import com.cc.entity.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

//@Controller
//@ResponseBody
//@RequestMapping("/api/user")
@RestController
@RequestMapping("/user")
public class UserController {
    //value：请求路径
    //produces：指定响应数据类型
    //method：指定请求方式
    @RequestMapping(value = "hi")
    public String getList(){

        return "员工列表数据";
    }
    @RequestMapping(value = "/getUser")
    public User  getUser(){
        User user = new User();
        user.setId(1);
        user.setName("张三");
        user.setPassword("123456");
        user.setAge(18);
        user.setSex("男");
        user.setEmail("123456@qq.com");
        user.setPhone("12345678901");
        user.setAddress("北京");
        return user;
    }

    //接受单参数
    @RequestMapping(value = "/getOneParam")
    public String getOneParam(String name){
        return "name:"+name;
    }
}
